
import multiprocessing
import time,os

queue = multiprocessing.Queue()

def test1():
    print(os.getpid())
    for i in range(30):
        data = queue.get()
        print(data)
        time.sleep(1)

def test2():
    print(os.getpid())
    for i in range(30):
        queue.put(i)
        print(queue)
        time.sleep(1)

def main():
    t1 = multiprocessing.Process(target=test1)
    t2 = multiprocessing.Process(target=test2)

    t1.start()
    t2.start()

if __name__ == '__main__':
    main()
